import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/home',
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    meta:{
      keep:true,
    }
  },
  {
    path: '/orders',
    name: 'orders',
    component: () => import('../views/OrdersView.vue'),
    meta:{
      keep:true,
    }
  },
  {
    path: '/customer',
    name: 'customer',
    component: () => import('../views/CustomerView.vue')
  },
  {
    path: '/userinfo',
    name: 'userinfo',
    component: () => import('../views/UserInfo.vue'),
    meta:{
      keep:true,
    }
  },
  {
    path: '/searchlist',
    name: 'searchlist',
    component: () => import('../views/SearchListView.vue')
  },
  {
    path: '/productdetails',
    name: 'productdetails',
    component: () => import('../views/ProductDetails.vue'),
  },
  {
    path: '/grouptours',
    name: 'grouptours',
    component: () => import('../views/GroupTours.vue')
  },
  {
    path: '/travelers',
    name: 'travelers',
    component: () => import('../views/TravelersView.vue')
  },
  {
    path:'/historicalhistory',
    name:'historicalhistory',
    component:() => import('../views/HistoricalHistory.vue')
  },
  {
    path:'/microtravel',
    name:'microtravel',
    component:() => import('../views/MicrotravelView.vue')
  },
  {
    path:'/map',
    name:'map',
    component:() => import('../views/mapView.vue')
  }
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
  linkActiveClass:"active",
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return {
        x: 0,
        y: 0
      }
    }
  }
    
})

export default router
